-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
pd.Timestamp constructor ignores missing arguments #32683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hello @ArtyomKaltovich! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:
|
Some tests failed due to changes, mostly pickle ones. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#31930 is more about raising when illegal combinations of arguments are specified together (not just tz)
I think there needs to be more discussion on the issue before we move forward with a solution.
Hello @mroeschke I've just faced with this bug recently at my job and decided to fix it. But you are right, it is more connected to the issue #31929 What if the other prohibited combinations? I can name only this one and ts_input with year, month and day specified via key params. I can add this check if it is not yet presented. Are there any more cases? functools.singledispatch could help us here, but it will probably slow down the execution. So I guess there is no better way here except the current one (I mean isinstance checking it the constructor body). Don't you agree? If you need a little bit more time to think about refactoring, can we for now submit it as a fix for #31929 ? Because, as I said previously it prevents me to implement work tasks and it is unexpected behavior what is good to avoid. I've just need to know if changing tz to key only param is acceptable or not? Thank you and sorry for mentioning the wrong issue :) Regards, |
I proposed #31930 (comment) as the only legal combination of parameters for #31930. Probably needs more discussion on that front. As for #31929 which you are trying to address, rearranging the arguments in the constructor would be an API change and would need to undergo a deprecation cycle. The easier solution in my option would be to deprecate the |
Actually
produces
but of course more research of performance, function wrupping and doc generation are needed. |
Do you want to try to address #31930 with |
If it is acceptable variant, why not?) But I am not familiar with Pandas CI performance testing, where can I read/know about it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think we can use singledispatch in cython (well we can but its going to be non-performant); you can try to prove me wrong though.
In any event, we simply want to validate combinations of parameters and reject invalid ones.
*, | ||
tz=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we cannot change the position of these args
Hello @jreback
|
Hello @mroeschke @jreback
but it still has problems with such code:
Because tz is the third arg and 1 is passed as tz, not day. I can create PR, because it fixes at least one problem, or we can continue to experiment, but I do not see any ways to fix it except singledispatch or parameter reordering :( Regards. |
In terms of performance testing see: https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#running-the-performance-test-suite I think these issues can be solved together by either reordering parameters or using singledispatch |
Thank you @mroeschke |
@ArtyomKaltovich do you have time to merge in master and address the review comments? |
Hello @mroeschke Regards. |
closing as stale |
Hello. The PR fixes #31930
Please review and merge if you think it is good enough :)
Regards,
Artyom.